# -*- coding: utf-8  -*-
#!/usr/local/bin/python

__author__ = 'jian.yao'

from cm.appserver.constants import AppServerType
from cm.appserver.decorators import AppServerConf

class SITE_APP_SERVER_DICT_CLS(dict):
    @classmethod
    def refresh(cls):
        _idc = -1
        _site_item = AppServerConf.get(_value=SITE_APP_SERVER_DICT.get("id"))
        if _site_item:
            SITE_APP_SERVER_DICT["idc"] = _site_item["idc"]
            SITE_APP_SERVER_DICT["host"] = _site_item["host"]
            SITE_APP_SERVER_DICT["port"] = _site_item["port"]
            SITE_APP_SERVER_DICT["lan_ip"] = _site_item["lan_ip"]
            SITE_APP_SERVER_DICT["wan_ip"] = _site_item["wan_ip"]
            SITE_APP_SERVER_DICT["server_type"] = _site_item["server_type"]

SITE_APP_SERVER_DICT = SITE_APP_SERVER_DICT_CLS()
SITE_APP_SERVER_DICT.update({
    "id" : 10000,
    "host" : "127.0.0.1",
    "port" : 80,
    "lan_ip" : "127.0.0.1",
    "wan_ip" : "127.0.0.1",
    "public_key" : "Shangdi-IDC-SNS-001",
    "secret_key" : "69767f26-3218-43e3-8e84-c414a8910000",
    "secret_type" : AppServerType.SNSServer,
    })
